package test.wk.database;

import java.sql.SQLException;
import com.wk.database.DatabaseConnector;
import com.wk.database.MachineState;
import com.wk.database.UpdatedSlaveMachine;
import com.wk.database.entity.Update;

public class DemoUpdateSlaveMachineState {
	public static void main(String[] args) {
		try {
			DatabaseConnector.connect("123.57.22.224:3306/bsd", "root", "yang1290");
		} catch (ClassNotFoundException e1) {
			e1.printStackTrace();
			return;
		} catch (SQLException e1) {
			e1.printStackTrace();
			return;
		}

		Update<UpdatedSlaveMachine> update = new Update<>(UpdatedSlaveMachine.class);
		try {
			update.connect(DatabaseConnector.getConnection());
		} catch (SQLException e) {
			e.printStackTrace();
			return;
		}

		try {
			int countUpdate = update.execute(new UpdatedSlaveMachine("10.103.240.73", MachineState.OFFLINE));
			System.out.println("更新数：" + countUpdate);
		} catch (SQLException e) {
			e.printStackTrace();
			return;
		}
	}
}
